#include<iostream>
#include"opt.h"
#include"vector.h"

typedef double (*Fun) (const math::vector<double> &);
typedef math::vector<double>(*Gun) (const math::vector<double> &);

double f(const math::vector<double> &x)
{
	return std::pow(x[0], 4) + x[0] * x[1] +std::pow( 1 + x[1], 2);
}

math::vector<double> df(const math::vector<double> & x)
{
	math::vector<double> ans(2);
	ans[0] = 4 * pow(x[0], 3) + x[1];
	ans[1] = x[0] + 2 * (1 + x[1]);
	return ans;
}

int main()
{
   math::vector<double> x0(2,0);
   x0[0] = 0;
   x0[1] = -0;
	std::cout << x0.size() << std::endl;
	//backtrack
	math::opt m1;
	//m1.PRPCG(f, df, x0, math::wolfe);
	//m1.FRCG(f, df, x0, math::backtrack);
	//m1.gradDescent(f, df, x0, math::goldstein);

	m1.PRPCG(f, df, x0, math::backtrack);
	std::cout << m1.opt_point[0] << " " << m1.opt_point[1] << std::endl;
//	std::cout << x0[0] << " " << x0[1] << std::endl;
}
